package com.cee.controller;

import com.cee.common.result.Result;
import com.cee.dto.JudgeDTO;
import com.cee.model.Judge;
import com.cee.model.OneSelect;
import com.cee.service.JudgeService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/judge")
public class JudgeController {

    @Autowired
    private JudgeService judgeService;


    @PostMapping("/list")
    public Result getJudgeList(@RequestBody JudgeDTO judgeDTO){
        PageInfo pageInfo = judgeDTO.getPageInfo();
        Page<Judge> Page = PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize());

        judgeService.getJudgeList(judgeDTO);
        return Result.ok(new PageInfo<>(Page));
    }


    @GetMapping("/delete")
    public Result deleteJudge(Integer id){
        judgeService.deleteJudge(id);
        return Result.ok();
    }

}
